package com.weishu.core.service.impl;

import com.weishu.common.core.utils.DateUtils;
import com.weishu.core.entity.JrSfLoan;
import com.weishu.core.mapper.JrRentInstallmentMapper;
import com.weishu.core.mapper.JrSfLoanMapper;
import com.weishu.core.service.IJrSfLoanService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * <p>
 * 收房贷申请信息 服务实现类
 * </p>
 *
 * @author zgx
 * @since 2021-10-19
 */
@Service
public class JrSfLoanServiceImpl extends ServiceImpl<JrSfLoanMapper, JrSfLoan> implements IJrSfLoanService {

    @Resource
    private JrSfLoanMapper tJrSfLoanMapper;
    @Resource
    private JrRentInstallmentMapper jrRentInstallmentMapper;
    @Override
    public JrSfLoan selectSfLoanDetails(Long sfId) {
        return tJrSfLoanMapper.selectSfLoanDetails(sfId);
    }
    /**
     * 新增收房贷申请信息
     *
     * @param jrSfLoan 收房贷申请信息
     * @return 结果
     */
    @Override
    public int insertTJrSfLoan(JrSfLoan jrSfLoan) {
        jrSfLoan.setCreateTime(DateUtils.getNowDate());
        jrRentInstallmentMapper.insertJrRentInstallment(jrSfLoan);
        return tJrSfLoanMapper.insertTJrSfLoan(jrSfLoan);
    }

}
